package com.common;

import java.sql.SQLException;
import java.util.Properties;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceFactory;
import com.alibaba.druid.pool.DruidPooledConnection;

public class DbPoolConnection_meet {
	private static DbPoolConnection_meet databasePool = null;
	private static DruidDataSource dds = null;
	static {
		Properties properties = PropertiesUtils.loadPropertyFile("config/db_meet.properties");
		try {
			dds = (DruidDataSource) DruidDataSourceFactory.createDataSource(properties);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private DbPoolConnection_meet() {
	}

	public static synchronized DbPoolConnection_meet getInstance() {
		if (null == databasePool) {
			databasePool = new DbPoolConnection_meet();
		}
		return databasePool;
	}

	public DruidDataSource getDataSource() throws SQLException {
		return dds;
	}

	public static DruidPooledConnection getConnection() throws SQLException {
		return dds.getConnection();
	}

}
